/*
 * Game.java
 *
 * Created on 26.11.2007, 15:24:19
 *
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.possoft.serializable.chess.game;

import cz.possoft.serializable.generic.Game;

/**
 *
 * @author mara
 *
 * Trida predstavuje jednu instanci hry sachy. Obsahuje vsechny dulezite informace o teto hre.
 */
public class ChessGame extends Game {

	public static final long serialVersionUID = 10045;	    

    // true pokud mel bilej sach
    private boolean melWhiteSach;

    // true pokud mel cernej sach
    private boolean melBlackSach;

    public boolean isMelBlackSach() {
        return melBlackSach;
    }

    public void setMelBlackSach(boolean melBlackSach) {
        this.melBlackSach = melBlackSach;
    }

    public boolean isMelWhiteSach() {
        return melWhiteSach;
    }

    public void setMelWhiteSach(boolean melWhiteSach) {
        this.melWhiteSach = melWhiteSach;
    }
    
    // pomocna metoda vraci primo sachovou sachovnici. Volano jen z ChessPanelu
    public ChessPole getSachovnice() {
    	return (ChessPole)getHraciPole();    	
    }

    // pri konstrukci neni hra vubec inicializovana. Sachovnice i jmena hracu zustavaji prazdne
    public Game setNoGame() {
        super.setNoGame();
        setHraciPole(new ChessPole(false));
        setMelBlackSach(false);
        setMelWhiteSach(false);                
        //NastaveniVrsekButton.getUlozeniMenuButton().setEnabled(false);        
        return this;
    }

    // hra je nastavena do stavu, ktery nastava pri standardne pri nove hre.
    public Game setNewGameState(String whitePlayerName, String blackPlayerName, boolean iAmWhite) {
        super.setNewGameState(whitePlayerName, blackPlayerName, iAmWhite);
        setHraciPole(new ChessPole(true));
        setMelBlackSach(false);
        setMelWhiteSach(false);                
        return this;
    }

}
